package apis

import (
	"cloud.google.com/go/language/apiv2"
	"context"
)

type ApiClient struct {
	cli *language.Client
}

func New(ctx context.Context, options ...ApiClientOptionFunc) (*ApiClient, error) {
	config := &ApiClientConfig{}
	for _, option := range options {
		option(config)
	}

	cli, err := language.NewClient(ctx, config.GenLanguageOptions()...)
	if err != nil {
		return nil, err
	}
	client := &ApiClient{
		cli,
	}
	
	return client, nil
}

func (s *ApiClient) Close() {
	s.cli.Close()
}
